package Login;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: syyyy
 * Date: 2025-07-16
 * Time: 16:48
 */
public class Login {
    private String name="admin";
    private String password="12345";

    public void login(String name,String password)throws UserNameException,UserPasswordException{
        if((!this.name.equals(name))){
            throw new UserNameException("用户名错误");
        }
        if((!this.password.equals(password))){
            throw new UserPasswordException("密码错误");
        }
        System.out.println("登陆成功");
    }

    public static void main(String[] args) {
        Login login=new Login();
        try{
            login.login("lala","12345");
        }catch(UserNameException e){
            e.printStackTrace();
        }catch(UserPasswordException e){
            e.printStackTrace();
        }
    }
}
